home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Main
- Caption = "MathFlash"
- ClientHeight = 5205
- ClientLeft = 450
- ClientTop = 1680
- ClientWidth = 8490
- Height = 5895
- Icon = MF_MAIN.FRX:0000
- Left = 390
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- ScaleHeight = 5205
- ScaleWidth = 8490
- Top = 1050
- Width = 8610
- Begin TextBox rnd1_objects
- BackColor = &H00FF0000&
- Height = 285
- Index = 0
- Left = 5760
- TabIndex = 18
- Text = " "
- Top = 1800
- Width = 255
- End
- Begin TextBox Text3
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 735
- Left = 3720
- TabIndex = 1
- Text = "Text3"
- Top = 960
- Width = 1215
- End
- Begin TextBox Text2
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 735
- Left = 1080
- TabIndex = 0
- Text = "Text2"
- Top = 960
- Width = 1215
- End
- Begin PictureBox Picture1
- Height = 495
- Left = 7560
- Picture = MF_MAIN.FRX:0302
- ScaleHeight = 465
- ScaleWidth = 465
- TabIndex = 17
- Top = 240
- Width = 495
- End
- Begin TextBox reward
- BackColor = &H00C000C0&
- ForeColor = &H00FF0000&
- Height = 405
- Index = 0
- Left = 7560
- TabIndex = 16
- Text = " "
- Top = 2880
- Width = 495
- End
- Begin TextBox rnd3_objects
- BackColor = &H0000C000&
- ForeColor = &H0000C000&
- Height = 285
- Index = 0
- Left = 3600
- TabIndex = 14
- Text = " "
- Top = 1800
- Width = 255
- End
- Begin TextBox rnd2_objects
- BackColor = &H000000C0&
- ForeColor = &H000000FF&
- Height = 285
- Index = 0
- Left = 960
- TabIndex = 13
- Text = " "
- Top = 1800
- Width = 255
- End
- Begin CommandButton quit
- Caption = "QUIT"
- Height = 735
- Left = 6000
- TabIndex = 7
- Top = 3720
- Width = 1335
- End
- Begin CommandButton Help
- Caption = "HELP"
- Height = 735
- Left = 4560
- TabIndex = 5
- Top = 3720
- Width = 1335
- End
- Begin CommandButton operation
- Caption = "/"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 735
- Index = 3
- Left = 3120
- TabIndex = 11
- Top = 3720
- Width = 855
- End
- Begin CommandButton operation
- Caption = "X"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 735
- Index = 2
- Left = 2160
- TabIndex = 10
- Top = 3720
- Width = 855
- End
- Begin CommandButton operation
- Caption = "-"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 735
- Index = 1
- Left = 1200
- TabIndex = 9
- Top = 3720
- Width = 855
- End
- Begin CommandButton operation
- Caption = "+"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 735
- Index = 0
- Left = 240
- TabIndex = 8
- Top = 3720
- Width = 855
- End
- Begin TextBox Text1
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 735
- Left = 5880
- TabIndex = 3
- Tag = "text1"
- Text = "Text1"
- Top = 960
- Width = 1215
- End
- Begin CommandButton hidden
- Caption = "ACCEPT"
- Default = -1 'True
- Height = 375
- Left = 5880
- TabIndex = 6
- Top = 480
- Width = 1215
- End
- Begin Label Label1
- Caption = "Bonus Bell"
- Height = 255
- Left = 7320
- TabIndex = 19
- Top = 0
- Width = 975
- End
- Begin Label score
- BackColor = &H0000FFFF&
- Caption = " "
- Height = 255
- Left = 2760
- TabIndex = 15
- Top = 4800
- Width = 2175
- End
- Begin Label correct
- BackColor = &H00FFFF00&
- Caption = " "
- Height = 255
- Left = 360
- TabIndex = 12
- Top = 4800
- Width = 2055
- End
- Begin Label Label3
- Caption = "="
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 495
- Left = 5280
- TabIndex = 2
- Top = 1080
- Width = 375
- End
- Begin Label operand
- Caption = "+"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 495
- Left = 2880
- TabIndex = 4
- Top = 1080
- Width = 375
- End
- Begin Menu utilityname
- Caption = "Utilities"
- Begin Menu limits
- Caption = "&Change Limits"
- End
- End
- Begin Menu About
- Caption = "About"
- End
- Rem sound drivers
- Declare Function closesound Lib "sound.drv" () As Integer
- Declare Function opensound Lib "sound.drv" () As Integer
- Declare Function SetVoiceSound Lib "sound.drv" (ByVal nSource%, ByVal Freq&, ByVal nDuration%) As Integer
- Declare Function StartSound Lib "sound.drv" () As Integer
- Sub About_Click ()
- about_form.Show
- End Sub
- Sub Command1_Click ()
- set_text_focus
- End Sub
- Sub display_objects ()
- Rem loading control array
- Dim starting, offset As Integer
- Rem drawing blocks for text1 (product box)
- rnd1_objects(0).Visible = True
- starting = 5760
- offset = 300
- For i = 1 To (answer - 1)
- Load rnd1_objects(i)
- rnd1_objects(i).Left = starting + offset
- If i > 14 Then
- rnd1_objects(i).Top = 3000
- ElseIf i > 9 Then
- rnd1_objects(i).Top = 2600
- ElseIf i > 4 Then
- rnd1_objects(i).Top = 2200
- Else
- rnd1_objects(i).Top = 1800
- End If
- rnd1_objects(i).Visible = -1
- rnd1_objects(i).Text = ""
- If offset = 1200 Then
- offset = 0
- Else
- offset = offset + 300
- End If
- Next i
- rnd2_objects(0).Visible = True
- starting = 960
- offset = 300
- For i = 1 To (rnd1 - 1)
- Load rnd2_objects(i)
- rnd2_objects(i).Left = starting + offset
- If i > 4 Then
- rnd2_objects(i).Top = 2200
- Else
- rnd2_objects(i).Top = 1800
- End If
- rnd2_objects(i).Visible = -1
- rnd2_objects(i).Text = ""
- If offset = 1200 Then
- offset = 0
- Else
- offset = offset + 300
- End If
- Next i
- rnd3_objects(0).Visible = True
- starting = 3600
- offset = 300
- For i = 1 To (rnd2 - 1)
- Load rnd3_objects(i)
- rnd3_objects(i).Left = starting + offset
- If i > 4 Then
- rnd3_objects(i).Top = 2200
- Else
- rnd3_objects(i).Top = 1800
- End If
- rnd3_objects(i).Visible = -1
- rnd3_objects(i).Text = ""
- If offset = 1200 Then
- offset = 0
- Else
- offset = offset + 300
- End If
- Next i
- End Sub
- Sub find_last ()
- lastrecord = LOF(1) / Len(student_rec)
- End Sub
- Sub form_load ()
- Unload limit
- main.Show
- load_operation
- Rem picture1.Picture = LoadPicture("misc07.ico")
- i = opensound()
- End Sub
- Sub Help_Click ()
- nl$ = Chr$(13) + Chr$(10)
- msg$ = "Type the answer to complete the equation in the " + nl$
- msg$ = msg$ + "empty box. Press ENTER or click 'ACCEPT'. " + nl$
- msg$ = msg$ + nl$
- msg$ = msg$ + "Boxes will be drawn when upper limit = 10 and" + nl$
- msg$ = msg$ + "the operation is addition or subtraction."
- msg$ = msg$ + nl$
- msg$ = msg$ + "Five correct answers rings bell and adds 1,000 points."
- MsgBox msg$
- set_text_focus
- End Sub
- Sub hidden_Click ()
- Select Case rnd_box
- Case 1
- user_input = Val(text1.Text)
- Case 2
- user_input = Val(text2.Text)
- Case 3
- user_input = Val(text3.Text)
- End Select
- If user_input = correct_answer Then
- Call sound(1000, 100)
- Rem msg$ = "Right Answer!"
- answer_flag = 0
- iteration = iteration + 1
- num_right = num_right + 1
- highscore = highscore + 100
- reward_draw
- percent_correct = Int((num_right / iteration) * 100)
- correct.Caption = Str$(percent_correct) + " % correct"
- score.Caption = "Score : " + Str$(highscore)
- If objects = True Then
- remove_objects
- End If
- Else
- Call sound(500, 100)
- msg$ = "Try Again."
- MsgBox msg$
- iteration = iteration + 1
- percent_correct = Int((num_right / iteration) * 100)
- correct.Caption = Str$(percent_correct) + " % correct"
- answer_flag = -1
- Select Case rnd_box
- Case 1
- text1.Text = " "
- Case 2
- text2.Text = " "
- Case 3
- text3.Text = " "
- End Select
- End If
- form_load
- End Sub
- Sub hide_objects ()
- rnd1_objects(0).Visible = False
- rnd2_objects(0).Visible = False
- rnd3_objects(0).Visible = False
- End Sub
- Sub limits_Click ()
- limit.Show
- End Sub
- Sub load_operation ()
- Rem answer_flag = 0 then right answer, -1 then wrong answer
- If answer_flag = 0 Then
- Randomize
- rnd_box = Int(Rnd * 3) + 1
- Select Case case_index
- Case 0
- rnd1 = Int(Rnd * (upper_limit + 1))
- rnd2 = Int(Rnd * (upper_limit + 1))
- answer = rnd1 + rnd2
- If upper_limit = 10 Then
- objects = True
- display_objects
- test_zero
- Else
- objects = False
- hide_objects
- End If
- Case 1
- rnd1 = Int(Rnd * (upper_limit + 1))
- Do
- rnd2 = Int(Rnd * (upper_limit + 1))
- Loop Until rnd1 >= rnd2
- answer = rnd1 - rnd2
- If upper_limit = 10 Then
- objects = True
- display_objects
- test_zero
- Else
- objects = False
- hide_objects
- End If
- Case 2
- rnd1 = Int(Rnd * (upper_limit)) + 1
- rnd2 = Int(Rnd * (upper_limit)) + 1
- answer = rnd1 * rnd2
- hide_objects
- objects = False
- Case 3
- Rem rnd2 can't be 0
- Do
- rnd1 = Int(Rnd * (upper_limit)) + 1
- rnd2 = Int(Rnd * (upper_limit)) + 1
- Loop Until (rnd1 / rnd2 - Int(rnd1 / rnd2)) = 0
- answer = rnd1 / rnd2
- hide_objects
- objects = False
- End Select
- Rem set_text_focus
- Rem MsgBox Str$(rnd_box)
- Select Case rnd_box
- Case 1
- text1.Text = " "
- text2.Text = Str$(rnd1)
- text3.Text = Str$(rnd2)
- text1.SetFocus
- correct_answer = answer
- Case 2
- text2.Text = " "
- text1.Text = Str$(answer)
- text3.Text = Str$(rnd2)
- text2.SetFocus
- correct_answer = rnd1
- Case 3
- text3.Text = " "
- text1.Text = Str$(answer)
- text2.Text = Str$(rnd1)
- text3.SetFocus
- correct_answer = rnd2
- End Select
- End If
- End Sub
- Sub operation_Click (Index As Integer)
- answer_flag = 0
- If objects = True Then
- remove_objects
- End If
- Select Case Index
- Case 0
- operand.Caption = "+"
- case_index = 0
- Case 1
- operand.Caption = "-"
- case_index = 1
- Case 2
- operand.Caption = "x"
- case_index = 2
- Case 3
- operand.Caption = "/"
- case_index = 3
- End Select
- load_operation
- End Sub
- Sub quit_Click ()
- If percent_correct > 0 Then
- On Error Resume Next
- Open "STUDENT.DAT" For Random As #1 Len = Len(student_rec)
- find_last
- lastrecord = lastrecord + 1
- student_rec.name = student_name
- student_rec.time = Str$(percent_correct)
- Put #1, lastrecord, student_rec
- Close #1
- End If
- i = closesound()
- End Sub
- Sub remove_objects ()
- hide_objects
- For i = 1 To (answer - 1)
- Unload rnd1_objects(i)
- Next i
- For i = 1 To (rnd1 - 1)
- Unload rnd2_objects(i)
- Next i
- For i = 1 To (rnd2 - 1)
- Unload rnd3_objects(i)
- Next i
- End Sub
- Sub renew_data_file_Click ()
- Kill "d:\vb2\student.dat"
- End Sub
- Sub reward_draw ()
- reward_counter = reward_counter + 1
- If reward_counter = 5 Then
- reward_hide
- End If
- If reward_counter > 0 Then
- Load reward(reward_counter)
- End If
- reward_y_start = 2880
- reward_y = reward_y_start - (reward_counter * 500)
- reward(reward_counter).Top = reward_y
- reward(reward_counter).Visible = -1
- End Sub
- Sub reward_hide ()
- For i = 1 To 4
- Unload reward(i)
- Next i
- highscore = highscore + 1000
- reward_counter = 0
- Call sound(800, 50)
- Call sound(1000, 50)
- Call sound(1200, 50)
- End Sub
- Sub set_text_focus ()
- Select Case rnd_box
- Case 1
- text1.SetFocus
- Case 2
- text2.SetFocus
- Case 3
- text3.SetFocus
- End Select
- End Sub
- Sub sound (ByVal Frequency As Long, ByVal Duration As Integer)
- Frequency = Frequency * 65536
- i = SetVoiceSound(1, Frequency, Duration)
- i = StartSound()
- End Sub
- Sub test_zero ()
- If rnd1 = 0 Then
- rnd2_objects(0).Visible = False
- End If
- If rnd2 = 0 Then
- rnd3_objects(0).Visible = False
- End If
- If answer = 0 Then
- rnd1_objects(0).Visible = False
- End If
- End Sub
- Sub upperlim_Click ()
- End Sub
-